#include "main.h"
#include "bftm.h"

void bftm_init(void)
{
  CKCU_PeripClockConfig_TypeDef CKCUClock = {{ 0 }};
  CKCUClock.Bit.BFTM0 = 1;
  CKCU_PeripClockConfig(CKCUClock, ENABLE);

  BFTM_SetCompare(HT_BFTM0, BFTM_COMPARE_VALUE);  // Set to maximum value to detect the timer overflow
  BFTM_SetCounter(HT_BFTM0, 0);
  BFTM_EnaCmd(HT_BFTM0, ENABLE);
}
